dojo.provide("uws.drawing.sqlerd.Attribute");
dojo.require('uws.drawing.Component');

dojo.declare('uws.drawing.sqlerd.Attribute',uws.drawing.Component,{
	constructor: function(surface,id,dx,dy, sortOrder,label,fromDS){
		this.center_x = 0;
		this.center_y = 0;
		this.label = label;
		this.sortOrder = sortOrder;
		
		if(fromDS){
			dx+=this.center_x;
			dy+=this.center_y;
		}
		
		//connectors
		this.top_con=this.connectors_shape_group.createCircle({
			cx: this.center_x,
			cy: -20,
			r:3
		}).setStroke("white").setFill("white");
		
		this.bottom_con=this.connectors_shape_group.createCircle({
			cx: this.center_x,
			cy: 20,
			r:3
		}).setStroke("white").setFill("white");
		
		this.left_con=this.connectors_shape_group.createCircle({
			cx: -60,
			cy: this.center_y,
			r:3
		}).setStroke("white").setFill("white");
		
		this.right_con=this.connectors_shape_group.createCircle({
			cx: 60,
			cy: this.center_y,
			r:3
		}).setStroke("white").setFill("white");
		
		//actual shape
		this.actual_shape_group.createEllipse({
			cx:0,
			cy:0,
			rx:60,
			ry:20
		}).setStroke("black").setFill("white");
		
		this.label_shape = this.actual_shape_group.createText({
			text: label,
			x:this.center_x,
			y:(this.center_y+8),
			align:"middle"
		}).setFill("black").setFont(defaultFont);

		
		this._postCreate(dx, dy);
	},
	applyProperties:function(properties){
		this.label = properties.label;
		this.description = properties.label;
		this.label_shape.setShape({
			text: this.label,
			x:this.center_x,
			y:(this.center_y+8),
			align:"middle"
		}).setFill("black").setFont(defaultFont);
	}
});